This plugin finds .dpkg-old and .dpkg-new files that dpkg creates
when it handles conffiles. They are typically in /etc, but
occasionally in some other locations, so we scan a list of directories
known to have conffiles. Any regular files with a .dpkg-old or
.dpkg-new suffix is added to the list.
The find-conffiles-dirs script in the source code does this.
'''
cruft_description = _("File was left on the disk by dpkg as part of its configuration file handling. If your computer works fine, you can remove it. You may want to compare it with the actual configuration file (the one without the .dpkg-old or .dpkg-new suffix). If unsure, don't remove the file.")
def __init__(self):
self.dirs = [
'/etc',
'/var/ax25',
'/var/cache/roxen4',
'/var/games',
'/var/lib/crafty',
'/var/lib/drac',
'/var/lib/firebird2',
'/var/lib/gnats',
'/var/lib/leksbot',
'/var/lib/linpopup',
'/var/lib/lxr-cvs',
'/var/lib/mason',
'/var/lib/roxen4',
'/var/lib/sysnews',
'/var/list',
'/var/spool/fcron',
'/var/spool/hylafax/bin',
'/var/yp']
def scan(self, dirname):
'''Scan one directory for crufty files.'''
list = []
for dirname, dirnames, filenames in os.walk(dirname):
filenames = _[1]
filenames = [ os.path.join(dirname, x) for x in filenames ]
filenames = _[3]
list += filenames
return list
def get_cruft(self):
list = []
for dir in self.dirs:
list += self.scan(dir)
return [ computerjanitor.FileCruft(x, self.cruft_description) for x in list ]